package com.example.demo.repository.two;

import com.example.demo.entity.two.Department;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by rex on 2017/6/8.
 */
public interface DepartmentRepository extends JpaRepository<Department, Integer> {
    @Query("select d from Department d where d.departmentid = :departmentid")
    Department withDepartmentId(@Param("departmentid") Integer departmentid);

    Department findByDepartmentid(Integer departmentid);

    List<Department> findByJibieOrderBySortAsc(int level);

    List<Department> findByDepartFidOrderBySortAsc(int fatherId);
}
